﻿#include<iostream>
using namespace std;
int main() {
	long long n, i, m;
	cin >> n >> m;
	int* a = new int[n];
	int b = 1;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	if (m != 0)
	{
		for (i = n - m; i < n; i++)
		{
			b = b * a[i];

		}

		cout << b;
	}
	else
		cout << "0";





	//system("pause");
}